home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d21 / optimz.tec < prev    next >
Text File  |  1991-04-17  |  19KB  |  402 lines

  1. ID:OP Quarterdeck's OPTIMIZE Program
  2. Quarterdeck Technical Bulletin #191
  3. by Russell Bell
  4.  
  5.      The purpose of this document is to give a brief statement of what the 
  6. OPTIMIZE program does and explain in detail how to handle common problems 
  7. that can occur when it is run.
  8.  
  9. 1)  What is OPTIMIZE?
  10.      
  11.      OPTIMIZE.COM is a program Quarterdeck supplies with its 
  12. memory managers (QEMM-386 and QEMM-50/60) and its memory 
  13. enhancer, QRAM.  The same program is used on all three products.  
  14.  
  15.      In this bulletin references to QEMM-386 should be construed 
  16. to apply to all three products.  The technote is not directly 
  17. related to the functioning of DESQview but DESQview may have more 
  18. memory available for its windows if the system has been 
  19. OPTIMIZEd.
  20.  
  21. 2)  What does OPTIMIZE do?
  22.  
  23.      The purpose of the OPTIMIZE program is to configure the 
  24. CONFIG.SYS and AUTOEXEC.BAT to leave the computer with the most 
  25. conventional memory (the memory below 640 kilobytes) possible and 
  26. the largest possible remaining areas of High RAM.  OPTIMIZE does 
  27. nothing permanent to the computer other than edit the CONFIG.SYS 
  28. and AUTOEXEC.BAT.  All the work that OPTIMIZE does can be done by 
  29. the user by hand or reversed by hand in whole or in part.  The 
  30. OPTIMIZE program does it more quickly and almost always better.
  31.  
  32. 3)  How does OPTIMIZE work?
  33.  
  34.      The first step of OPTIMIZE copies the CONFIG.SYS to 
  35. CONFIG.QDK and the AUTOEXEC.BAT to AUTOEXEC.QDK so that, if 
  36. OPTIMIZE fails for some reason, or if the user wishes to return 
  37. to the configuration before OPTIMIZation, the original system 
  38. files are available.
  39.  
  40.      The second step of OPTIMIZE puts the "RAM" parameter on the 
  41. QEMM-386 command line and runs "LOADHI/GS" on all the device 
  42. drivers in the CONFIG.SYS and all the TSRs in the AUTOEXEC.BAT 
  43. and then reboots the computer.  For QRAM users the RAM parameter 
  44. is redundant:  QRAM creates high RAM automatically.  On systems 
  45. with DOS versions 2.x and 3.x all the buffers (except one) will 
  46. be moved from the CONFIG.SYS to the AUTOEXEC.BAT to load them 
  47. high.  On systems with DOS version 4 it is a more efficient use 
  48. of memory to load the buffers into expanded memory using the DOS 
  49. feature, the "/x" parameter.  Quarterdeck's BUFFERS.COM cannot be 
  50. used with DOS 4.  See below for a further discussion of this 
  51. issue.  OPTIMIZE uses the "/GS" parameter to determine how much 
  52. memory a driver or TSR requires to be loaded into memory.
  53.  
  54.      If the AUTOEXEC.BAT ends with a program that remains in 
  55. control of the computer (such as a menu program) rather than 
  56. exiting to DOS then you must exit that program to continue 
  57. OPTIMIZation.
  58.  
  59.      The third step of OPTIMIZE actually loads the device drivers 
  60. and TSRs high.  If it fails, the old CONFIG.SYS and
  61. AUTOEXEC.BAT are restored.
  62.  
  63.      If all the device drivers and TSRs can be loaded high then 
  64. OPTIMIZE will load them all high and leave a new CONFIG.SYS and 
  65. AUTOEXEC.BAT on the system.  If they cannot all be loaded high,
  66. OPTIMIZE runs through all possible configurations and chooses the 
  67. ones that leave the most conventional memory available.  If the
  68. OPTIMIZE process has completed then the screen will read:
  69.  
  70.      The OPTIMIZE process is complete.
  71.  
  72. If it does not then something has gone wrong.
  73.  
  74.  
  75. THE LOADHI UTILITIES
  76.      
  77. 1)  What does LOADHI do?
  78.  
  79.      LOADHI.COM loads resident programs (TSRs) into the high RAM 
  80. created by QEMM-386 (or QEMM-50/60 or QRAM).  LOADHI.SYS performs 
  81. the same function for device drivers.
  82.  
  83. 2)  What can LOADHI not do?
  84.  
  85.      LOADHI.SYS cannot load high any program or driver that loads 
  86. more than two programs or drivers in turn.  LOADHI.COM cannot 
  87. load the programs in a batch file high.  If you are calling a 
  88. batch file from the AUTOEXEC.BAT then you must put its contents 
  89. explicitly in the AUTOEXEC.BAT in order for OPTIMIZE to load them 
  90. high.  Alternatively you may load them high by editing the batch 
  91. file yourself as described in the LOADHI chapter of the manual.
  92.  
  93. 3) How much memory is needed to load a program high?
  94.  
  95.      LOADHI must have enough memory available to load a program.  
  96. A program may use more memory to load than to remain resident.  
  97. LOADHI/GS reports both the amount of memory needed to load and 
  98. the amount needed to stay resident.  The amount of memory needed 
  99. to load, not just the amount needed to stay resident, must be 
  100. available in one contiguous block for a program to be loaded 
  101. high. OPTIMIZE creates a file named "LOADHI.OPT" in the QEMM (or 
  102. QRAM) directory that contains two numbers for each TSR or device 
  103. driver: the memory size needed to load the TSR (or device driver) 
  104. and the memory size needed for it to stay resident.
  105.  
  106. 4)  Why does my program not load high?
  107.  
  108.      Some programs refuse to be loaded high.  They may be 
  109. unwilling to be loaded above conventional memory or they may 
  110. refuse to be crammed into the region in which OPTIMIZE puts them 
  111. or they may have some other complaint. These programs are rare, 
  112. but there is no fix for their objection.
  113.      If a program (or device driver) does not remain resident 
  114. there is no point in loading it high.  This can be discovered by 
  115. looking at the second number LOADHI/GS reports (or the second 
  116. number in LOADHI.OPT): if this number is 0 then the program does 
  117. not stay in memory and does not need to be loaded high.
  118.  
  119. 5)  How can I tell what is being loaded high?
  120.  
  121.      Running "LOADHI" with no parameters or programs to load will 
  122. give a status report indicating what the high RAM regions are, 
  123. what is loaded into them, and what areas are available.  The 
  124. First Meg/Programs page of Manifest also shows what programs are 
  125. loaded high as well as those loaded low.
  126.      
  127.      TROUBLESHOOTING
  128.  
  129. 1)  What should I do if OPTIMIZE fails?
  130.  
  131.      If OPTIMIZE does not end by reporting "The OPTIMIZE process
  132. is complete," you should look at your CONFIG.SYS and AUTOEXEC.BAT 
  133. to see if they are unchanged.  If they are as they were in the 
  134. beginning then OPTIMIZE has not completed.  If the CONFIG.SYS 
  135. contains "DEVICE=C:\QEMM\RSTRCFG.SYS **** OPTIMIZE S%tep 2 [or 3]  
  136. ****" and the AUTOEXEC.BAT is "@OPT2" or "@OPT3" then OPTIMIZE 
  137. has failed and you should restore CONFIG.QDK to CONFIG.SYS and 
  138. AUTOEXEC.QDK to AUTOEXEC.BAT.  If the CONFIG.SYS and AUTOEXEC.BAT 
  139. do not have these lines in them, and they are not as they were 
  140. before running OPTIMIZE, and LOADHI reports that there are 
  141. programs loaded high, then OPTIMIZE was successful and you just 
  142. missed the message "The OPTIMIZE process is complete".
  143.  
  144.    2)  What can go wrong?
  145.  
  146.      A)  In general:
  147.  
  148.      If you have a third-party disk partitioner then drives other 
  149. than C: sometimes do not exist until it is loaded. In these cases
  150. if you put QEMM-386 on any drive other than the C: drive, the disk 
  151. partitioner must be loaded first.
  152.  
  153.      OPTIMIZE cannot OPTIMIZE a CONFIG.SYS or AUTOEXEC.BAT longer 
  154. than 512 lines. 
  155.  
  156.      DOS does not allow lines longer than 128 characters in the 
  157. AUTOEXEC.BAT.
  158.  
  159.      During the OPTIMIZE process lines are temporarily lengthened.  If
  160. you have a very long line, OPTIMIZE may increase it to more than 128
  161. characters long.  Shorten such a line if possible. If this is not
  162. possible then using the "/PATH" switch on OPTIMIZE may help.  See the
  163. section on "switches" below.  OPTIMIZE may also fail in certain rare
  164. circumstances if QEMM-386 is the first line in the CONFIG.SYS.  Try
  165. putting something harmless that does not get loaded high in the
  166. CONFIG.SYS before the QEMM-386 line, such as the "FILES=??" command
  167. (where "??" is the amount of FILES you want to load in the
  168. CONFIG.SYS).
  169.  
  170.      Some error messages may be reported during the optimization 
  171. process that can be ignored, since OPTIMIZE proceeds normally
  172. after reporting the error. For example:
  173.  
  174. --OPTIMIZE reports an error when it finds a batch file being
  175. loaded in the AUTOEXEC.BAT, reporting that batch files cannot be 
  176. loaded high.
  177.  
  178. --If you are using a command processor other than Microsoft's
  179. COMMAND.COM (such as 4DOS) that has internal commands that Microsoft's
  180. DOS does not have, LOADHI will not recognize them.  LOADHI will treat
  181. such a command as an external command, reporting a "file not found"
  182. error when it is encountered.
  183.  
  184.      B)  In the first step:
  185.  
  186.      All that happens in the first step of OPTIMIZE is that 
  187. backup copies of the CONFIG.SYS and AUTOEXEC.BAT are made to 
  188. CONFIG.QDK and AUTOEXEC.QDK.  Nothing should go wrong here.
  189.  
  190.      C)  In the second step:
  191.  
  192.      If OPTIMIZE fails at the second step then the two likely 
  193. causes are some conflict with memory management or a conflict in 
  194. the address space.  The most common cures for conflicts in memory 
  195. management are the QEMM-386 parameters "NOSH and "NT".
  196.      QEMM-386 tries to manage the unused portions of two 
  197. different varieties of Chips & Technologies shadowRAM but
  198. sometimes incorrectly identifies a different implementation as 
  199. one that it knows how to use.  "NOSH" tells QEMM-386 not to try 
  200. to use the shadowRAM, clearing this kind of error.
  201.      "NT" tells QEMM-386 not to try to manage Top Memory.  This 
  202. is another kind of memory, located at the top of the 16 meg 
  203. address space, that QEMM-386 may misdetect or mismanage.  If your 
  204. machine has no shadowRAM or Top Memory then these parameters will 
  205. not affect the performance of the computer.
  206.  
  207.      The other likely cause of OPTIMIZE failing at the second 
  208. step is that QEMM-386 is placing High RAM in a portion of the 
  209. address space used by another device (hardware device) on the 
  210. system.  If you have a network card, disk controller with ROM, 
  211. scanner with a RAM buffer, video capture card, or any of a number 
  212. of devices, you may have such a conflict.   QEMM-386 does not 
  213. always recognize the address space used by these devices; an
  214. explicit exclude parameter ("x=mmmm-nnnn") on the QEMM-386 command
  215. line may be needed.  You should consult the manuals of your hardware
  216. to find out what pieces of the address space they use.  If this is not
  217. possible then you can follow the analysis procedure as explained in
  218. the QEMM or Manifest manual before running OPTIMIZE or adding the RAM
  219. parameter.  If you wish to do none of these you can exclude all of the
  220. high RAM area ("x=a000-ffff") and then cut down on this exclude
  221. ("x=c800-efff", then "x=c800-dfff", then "x=c800-d7ff", and so on; or
  222. "x=e000-ffff", then "x=e000-efff", then "x=e000-e7ff", and so on)
  223. until you find the smallest portion(s) of the address space that
  224. QEMM386 must be instructed not to use to prevent the conflict.
  225.  
  226.      The OPTIMIZE process can also fail at the second step if the 
  227. file "RSTRCFG.SYS" is corrupted.  You can copy this file over 
  228. anew from the QEMM-386 source disk to the QEMM directory.
  229.  
  230.      Finally, some programs will fail on the second step of 
  231. OPTIMIZE because they are incompatible with the LOADHI program, 
  232. even though the /GS parameter used in the second step of OPTIMIZE 
  233. prevents any actual loading into HIGH RAM.  In this case you 
  234. should remark the program out (by inserting the command "rem" at 
  235. the beginning of the line on which the program is loaded) for the 
  236. duration of the OPTIMIZE process.  If this program is needed in 
  237. order to load other programs, see the information on OPTIMIZE's 
  238. /L parameter in the Switches section below.
  239.  
  240.  
  241.      C)  In the third step:
  242.  
  243.      If OPTIMIZE fails at the third step then the cause is:
  244.  
  245.       i) an attempt to load some driver or program high that objects;
  246.  
  247.       ii) loading high into a piece of the address space that is being used
  248.           by a hardware device (conflicts are often found only when
  249.           something is loaded high into an area);
  250.       iii) the existence of a bus-mastering hard disk controller
  251.            (usually a SCSI disk controller, but others are possible
  252.            culprits).
  253.  
  254.      i)  If some driver or TSR misbehaves when loaded high then 
  255. the cure is to remark it out (by inserting "rem " before it on 
  256. its command line) for the duration of the OPTIMIZE process.  (If 
  257. this program is needed in order to load other programs, see the 
  258. information on OPTIMIZE's /L parameter in the Switches section 
  259. below.) You may need to find out which program is causing the 
  260. problem by optimizing with the AUTOEXEC.BAT out of the way (by 
  261. renaming it to something else) to isolate the problem to the 
  262. CONFIG.SYS or AUTOEXEC.BAT and then narrowing down which 
  263. program(s) object to being loaded high by loading partial 
  264. AUTOEXEC.BATs.
  265.  
  266.      ii)  If an address conflict is the problem then the area in 
  267. conflict must be excluded as mentioned above in the 
  268. troubleshoooting section for step 2.
  269.  
  270.      iii)  If your system has a bus-mastering hard disk 
  271. controller then you must use the "db=xx" parameter on the QEMM 
  272. command line. "xx" should be a number between 2 and 10.  This 
  273. parameter sets aside a buffer of "xx" kilobytes in unmapped 
  274. conventional memory for diversion of disk i/o from mapped memory. 
  275. If you do not know whether you have such a device give this a try 
  276. to see if it works.   If your system has a bus-mastering disk 
  277. controller then a better solution is to use the VDS (Virtualized 
  278. DMA Services) driver that the manufacturer may have written.  If 
  279. your bus-mastering device is not a hard disk controller the VDS 
  280. driver is necessary if you wish to LOADHI.  See the Quarterdeck 
  281. technical note #121,"bus-mast.tec," for more information on this
  282. subject.
  283.  
  284.      DOS RESOURCES
  285.  
  286. BUFFERS:  OPTIMIZE tries to load buffers high for all DOS 
  287. versions 2.x and 3.x.  It does this by decreasing the buffers 
  288. loaded in the CONFIG.SYS to one and loading the rest in the 
  289. AUTOEXEC.BAT with a statement like:
  290.  
  291.      "C:\QEMM\LOADHI /R:1 C:\QEMM\BUFFERS=20".  
  292.  
  293. One buffer must be left loaded in the CONFIG.SYS (DOS defaults to 
  294. providing a higher number if none are specified).
  295.  
  296. 1)  What if I have DOS 4?
  297.  
  298.      Microsoft changed the structure of buffers with version 4 of 
  299. DOS, making it possible to load buffers into expanded memory. 
  300. This is preferable to loading them high because no address space 
  301. at all is used.  If you are using DOS 4 or later then you may use 
  302. the "/x" switch (e.g.:  "buffers=20/x").  Note that expanded 
  303. memory can be used only in 16K increments, so that buffers loaded 
  304. into expanded memory are allocated 30 at a time; no matter how 
  305. few you specify, with the "/x" parameter you get at least 30.  
  306. Before using the "/X" parameter for DOS buffers, run Manifest and 
  307. check the "Hints" section to verify that it suggests loading 
  308. buffers high with /X.  Some early DOS 4 versions have a bug which 
  309. make it unwise to use this feature.  Manifest can detect this and 
  310. will not recommend loading buffers high if it detects the bug. In 
  311. addition, the /X parameter should not be used on BUFFERS until 
  312. the RAM parameter has been placed on QEMM-386.
  313.  
  314.      2)  What if I am using a third-party disk partitioner?
  315.  
  316.      You may find that your buffers are using some huge amount of 
  317. memory.  If you are creating disk partitions larger than 32 MB 
  318. with a version of DOS earlier than DOS 4, the size of each
  319. buffer increases with the size of the sector.  If you are missing 
  320. a lot of memory then you may want to check the DOS/Overview page 
  321. of Manifest to see how much space your buffers are taking.  A 
  322. buffer is 528 bytes for a normal 512-byte sector.  For partitions 
  323. larger than 32 MB the sector size grows by factors of two and the 
  324. buffer size follows.  This has nothing to do with OPTIMIZE or 
  325. QEMM386:  your buffers use this much space even if you do not run 
  326. OPTIMIZE or load QEMM-386.  You can see this by comparing the 
  327. amount of memory the buffers are using in the DOS/Overview page 
  328. of Manifest with and without QEMM386. 
  329.  
  330. FILES, FCBS, LASTDRIVE:  OPTIMIZE does not load any of these DOS
  331. resources high.  Since they use a comparatively small amount of
  332. memory, this does not affect most users. If you want to load them
  333. high, you must do so by hand in imitation of the way buffers are
  334. loaded high: decrease the number in the CONFIG.SYS to a minimum and
  335. use LOADHI (for example: C:\QEMM\LOADHI C:\QEMM\FILES=40) in the
  336. AUTOEXEC.BAT.  Note that because the drive specifiers must be
  337. contiguous lastdrive creates a duplicate set of drive specifiers high
  338. for all that were loaded low.  This means that the number loaded low
  339. should be minimized in the CONFIG.SYS (for example:  "lastdrive=c"
  340. since DOS defaults to "lastdrive=e") if "LASTDRIV.COM" is used to load
  341. drive specifiers high.  Although OPTIMIZE does not load any of these
  342. DOS resources high, once you have them loaded high OPTIMIZE will fit
  343. them into high RAM in the location in which they will most efficiently
  344. fit.
  345.  
  346.      SHARE
  347.  
  348.      If you have disk partitions larger than 32 MB with DOS 4 or greater 
  349. and are partitioning the disk with FDISK then SHARE.EXE is loaded 
  350. implicitly by DOS.  Optimize will not load it high unless it is explicitly 
  351. invoked in the CONFIG.SYS, for example:
  352.  
  353.      install c:\dos\share.exe
  354.  
  355.  
  356.      NETWORK OPTIMIZATION
  357.  
  358.      If you are optimizing on a system where the COMSPEC is being 
  359. changed to a network drive then the AUTOEXEC.BAT and CONFIG.SYS 
  360. in the directory where the comspec points will be changed by 
  361. OPTIMIZE.  If you want the AUTOEXEC.BAT and CONFIG.SYS on a local 
  362. drive to be OPTIMIZEd instead then OPTIMIZE can be invoked with 
  363. the "/B:a" switch (for example:  OPTIMIZE /B:a) where "a" is the 
  364. drive containing the AUTOEXEC.BAT and CONFIG.SYS to be OPTIMIZEd. 
  365.  
  366.  
  367.  
  368.      SWITCHES
  369.  
  370.      /B:x
  371.      This switch causes OPTIMIZE to modify the CONFIG.SYS and AUTOEXEC.BAT 
  372. files on the "x" drive.
  373.      /L
  374.      This switch causes OPTIMIZE to modify only those lines of 
  375. the CONFIG.SYS and AUTOEXEC.BAT that already have the LOADHI 
  376. instruction on them (for example:  "device=c:\qemm\loadhi.sys 
  377. /r:2 driver.sys" or "c:\qemm\loadhi /r:1 c:\mouse\mouse"). This 
  378. can be used to run OPTIMIZE and leave programs that you do not 
  379. want loaded high untouched.  You can do this by running OPTIMIZE, 
  380. then removing the LOADHI portion ("C:\QEMM\LOADHI /r:?") from the 
  381. line of the program that you do not want loaded high, then 
  382. running OPTIMIZE /L.
  383.      /PATH
  384.      This switch adds the OPTIMIZE path to each command line so that
  385. "C:\QEMM\" is not added every time LOADHI is invoked.  This makes these 
  386. lines shorter and may be useful for those with very long lines. 
  387.  
  388.  
  389. SUMMARY
  390.  
  391.      OPTIMIZE is an important feature of QEMM386, QEMM 50/60, and 
  392. QRAM.  It is unparalleled in loading programs into memory in the 
  393. most efficient manner.  Problems running OPTIMIZE are rare and it 
  394. is worth the user's time to resolve them.  Once the problem is 
  395. solved the user should be able to run OPTIMIZE in the future, 
  396. when he/she changes his/her system's configuration, without 
  397. additional difficulty.
  398.  
  399.  
  400.                Copyright (C) 1991 by Quarterdeck Office Systems
  401.                     * * *   E N D   O F   F I L E    * * *
  402.